module model.Transform;

import message.MsgDefine;
import model.User;
import hunt.net.Connection;
import std.conv;
import std.random;
import hunt.logging;


static message.MsgDefine.User toUser(model.User.User user)
{
    if (user !is null)
    {
      auto resUser = new message.MsgDefine.User();

      resUser.id = to!string(user.id);
      resUser.nickname = user.nickname;
      resUser.avatar = user.avatar;
      resUser.gender = to!string(user.gender);
      resUser.birthday = user.birthday;
      resUser.addValidation = user.addValidation;
      resUser.mobile = user.mobile;
      resUser.qrcode = user.qrcode;
      resUser.username = user.username;
      return resUser;
    }
    else
    {
      auto resUser = new message.MsgDefine.User();
      resUser.id = "0";
      return resUser;
    }
}
